package server.unit;

import java.io.Serializable;
import java.util.Date;

public class Message implements Serializable {
    private transient Client client;
    private String fullNameWithLobby;
    private String message;
    private Date dateTime;

    public Message(Client client, String fullName, String message) {
        this.client = client;
        fullNameWithLobby = fullName;
        this.message = message;
        dateTime = new Date();
    }

    public static boolean isMessageFit(String message) {
        return (message.length() <= 150) && (message.length() >= 1);
    }

    public Client getClient() {
        return client;
    }

    @Override
    public String toString() {
        return "mes " + dateTime + " " + fullNameWithLobby + ":\n" + message;
    }
}
